package com.tuanzi.loan.business.entity.receipt.product;

import com.tuanzi.loan.core.entity.AuditEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

@Data
@Entity
@Table(name="LOAN_RECEIPT_PRODUCT_PRICE")
@EqualsAndHashCode(callSuper = true)
public class ReceiptProductPrice extends AuditEntity {

    @Id
    @Column(name = "ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name = "PRODUCT_ID")
    private Long productId;

    @Column(name = "UNIT_PRICE")
    private BigDecimal unitPrice;

    @Max(Integer.MAX_VALUE)
    @Min(0)
    @Column(name = "MAX_APPLY")
    private Integer maxApply;

    @Max(Integer.MAX_VALUE)
    @Min(0)
    @Column(name = "MIN_APPLY")
    private Integer minApply;

    @Length(max = 255)
    @Column(name = "REMARK")
    private String remark;

}
